{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "#  折线图的基本使用和配置\n",
    "from pyecharts.charts import Line\n",
    "from pyecharts import options as opts\n",
    "\n",
    "line = (\n",
    "    Line()\n",
    "    .add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "    .add_yaxis('商家A', [5, 20, 36, 10, 75, 90])\n",
    "    .add_yaxis('商家B', [15, 120, 136, 110, 175, 190])\n",
    ")\n",
    "line.render_notebook()"
   ],
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {},
   "cell_type": "code",
   "source": [
    "# 系列配置项的使用\n",
    "line = (\n",
    "    Line(init_opts=opts.InitOpts(width=\"1080px\", height=\"720px\"))\n",
    "    .add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "    .add_yaxis('商家A', [5, 20, 36, 10, 75, 90])\n",
    "    .add_yaxis('商家B', [15, 120, 136, 110, 175, 190])\n",
    "    .set_series_opts(\n",
    "        linestyle_opts=opts.LineStyleOpts(\n",
    "            type_='dotted',  #  设置折线线型  dashed  solid  dotted\n",
    "            color='pink',  #线条颜色\n",
    "            width=2,  # 线条宽度\n",
    "        ),\n",
    "    )\n",
    ")\n",
    "line.render_notebook()"
   ],
   "id": "9fc1e6619c18ecd3",
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {},
   "cell_type": "code",
   "source": [
    "#标签配置项\n",
    "line = (\n",
    "    Line(init_opts=opts.InitOpts(width=\"1080px\", height=\"720px\"))\n",
    "    .add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "    .add_yaxis('商家A', [5, 20, 36, 10, 75, 90])\n",
    "    .add_yaxis('商家B', [15, 120, 136, 110, 175, 190])\n",
    "    .set_series_opts(\n",
    "        label_opts=opts.LabelOpts(\n",
    "            is_show=True,\n",
    "            position='top',  #数值显示位置\n",
    "            font_size=20,\n",
    "            font_family='宋体',\n",
    "            font_weight='bold',\n",
    "            font_style='italic',  # 设置斜体\n",
    "            rotate=-30  # -90 ~ 90\n",
    "        )\n",
    "    )\n",
    ")\n",
    "line.render_notebook()\n"
   ],
   "id": "b04a6cbf6401c34b",
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {},
   "cell_type": "code",
   "source": [
    "#  设置 标记点\n",
    "line = (\n",
    "    Line(init_opts=opts.InitOpts(width=\"1080px\", height=\"720px\"))\n",
    "    .add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "    .add_yaxis('商家A', [5, 20, 36, 10, 75, 90])\n",
    "    .add_yaxis('商家B', [15, 120, 136, 110, 175, 190])\n",
    "    .set_series_opts(\n",
    "        markpoint_opts=opts.MarkPointOpts(\n",
    "            data=[\n",
    "                opts.MarkPointItem(type_='max', symbol_size=40),  # max min average\n",
    "                opts.MarkPointItem(type_='average', symbol_size=40),\n",
    "                opts.MarkPointItem(type_='min', symbol_size=40)\n",
    "            ]\n",
    "\n",
    "        )\n",
    "    )\n",
    ")\n",
    "line.render_notebook()"
   ],
   "id": "aea77ef7bb40c09a",
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {},
   "cell_type": "code",
   "source": [
    "#  设置 标记线\n",
    "line = (\n",
    "    Line(init_opts=opts.InitOpts(width=\"1080px\", height=\"720px\"))\n",
    "    .add_xaxis([\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"])\n",
    "    .add_yaxis('商家A', [5, 20, 36, 10, 75, 90])\n",
    "    .add_yaxis('商家B', [15, 120, 136, 110, 175, 190])\n",
    "    .set_series_opts(\n",
    "        markline_opts=opts.MarkLineOpts(\n",
    "            data=[\n",
    "                opts.MarkLineItem(type_='max', symbol_size=10),\n",
    "            ],\n",
    "            label_opts=opts.LabelOpts(\n",
    "                color='red'\n",
    "            )\n",
    "        )\n",
    "    )\n",
    ")\n",
    "line.render_notebook()"
   ],
   "id": "f18f35b11d306aac",
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {},
   "cell_type": "code",
   "source": "",
   "id": "e4296e132a357dc6",
   "outputs": [],
   "execution_count": null
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
